package com.zhenmaitang.clinic_sys.entity;

import java.time.LocalDateTime;
import io.swagger.v3.oas.annotations.media.Schema;

/**
 * 角色实体类 - 系统角色定义
 */
@Schema(description = "系统角色实体", example = "角色信息")

public class Role {
    @Schema(description = "角色ID", example = "1")
    private Integer id;
    
    @Schema(description = "角色名称", example = "医生", requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;
    
    @Schema(description = "角色描述", example = "医院医生角色，具有患者信息查看权限")
    private String description;
    
    @Schema(description = "权限配置", example = "[\"USER_READ\", \"PATIENT_READ\"]", type = "string", format = "json")
    private String permissions; // 权限配置，JSON格式存储
    
    @Schema(description = "是否启用", example = "true", defaultValue = "true")
    private Boolean enabled;
    
    @Schema(description = "创建时间", example = "2024-01-15 10:30:00")
    private LocalDateTime createTime;
    
    @Schema(description = "更新时间", example = "2024-01-15 14:20:00")
    private LocalDateTime updateTime;

    // 构造函数
    public Role() {}

    public Role(String name, String description, String permissions) {
        this.name = name;
        this.description = description;
        this.permissions = permissions;
        this.enabled = true;
        this.createTime = LocalDateTime.now();
        this.updateTime = LocalDateTime.now();
    }

    // Getter和Setter方法
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPermissions() {
        return permissions;
    }

    public void setPermissions(String permissions) {
        this.permissions = permissions;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "Role{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", permissions='" + permissions + '\'' +
                ", enabled=" + enabled +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
}